<%@ page pageEncoding="UTF-8"%>
<div class='panel'>
	<table class='title' cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td class='left'></td>
			<td class='middle'>
				微信用户信息统计
			</td>

			<td class='right'></td>
		</tr>
	</table>
	<div class='content'>
	
	<form id="wxStatisSearchForm" name="entSearchForm" method="post">
			<input type="hidden" name="pageSize" value="10">
			<div class='buttonPanel'>
				<label>
					开始日期&nbsp;
				</label>
				<input type="text" name="sdate" value="${sdate}" readonly="readonly"  id="queryStartDate" >
				<label>
					结束日期&nbsp;
				</label>
				<input type="text" name="edate" value="${edate}" readonly="readonly" id="queryEndDate">
				
				<label>
					统计类型&nbsp;
				</label>
				<select name="keyType" id="s_keyType"  class="select" >
				    <option  value='1'>增长趋势</option>
				    <option  value='4'>累积趋势</option>
				</select>
				<a class="k-button" onclick="showWxStatisDatas(); "><span class="k-icon k-i-search"></span>统计</a>
			</div>
		</form>
		<p>
		<label>
			趋势图&nbsp;
		</label>
			<hr>
			<div id='lineChart' style="height: 400px;text-align: center;" class='tablePanel'>
			<font style="font-size: 12px;color: #f33;">没有查询到日报数据....</font>
			</div>
			<br>
			<label>
			趋势详解（该定时统计数据计算，而按门店统计信息根据当前实时数据计算，两者可能不一致。）&nbsp;
			</label>
			<hr>
		<div id='entTable'class='tablePanel'>
			
		</div>
	<hr>
	    <label>
		按门店统计信息&nbsp;
		</label>
		<hr>
		<table class="main_table" cellspacing="0" cellpadding="0" style="width: 100%">
			<tr>
				<th>
					粉丝总数
				</th>
				<th>
					门店用户
				</th>
				<th>
					普通用户
				</th>
				<th>
					关注用户
				</th>
				<th>
					曾关注用户
				</th>
			</tr>
			<tr id="dataTr">
				<td>
					${bean.totalNum}
				</td>
				<td>
					${bean.mendNum}
				</td>
				<td>
					${bean.feiMendNum}
				</td>
				<td>
					${bean.guanzhuNum}
				</td>
				<td>
					${bean.quxiaoNum}
				</td>
			</tr>
			
			<tr  style="height: 400px;">
			<td colspan="5" id="dataCharts">
			
			</td>
			</tr>
		</table>
	</div>
</div>
<script>
var charts;
var reportJson=${reportJson};
var keyType='${keyType}';
var  objSelect=document.getElementById("s_keyType");
for (var i = 0; i < objSelect.options.length; i++){
	if(objSelect.options[i].value == keyType){objSelect.options[i].selected = true;break;}
}
var trshtml="<tr><th>日期</th><th>新增用户数</th><th>取消关注用户数</th><th>总关注用户</th></tr>";


$(function(){
	//initRangeDatepickerWithMaxMin("queryStartDate","queryEndDate","${sdate}","${edate}", '', "${edate}");
	initFormToDatepicker("queryStartDate","queryEndDate","${sdate}","${edate}");
	if(reportJson.categories&&reportJson.categories.length>0){
		var charts2= new Highcharts.Chart({
		 chart: {
                    renderTo: 'lineChart',          //放置图表的容器
                    defaultSeriesType: 'spline',    //图表类型line, spline, area, areaspline, column, bar, pie , scatter
                },
        title: {
            text: reportJson.title
        },
        subtitle: {
            text: reportJson.subtitle
        },
        xAxis: {
        	tickmarkPlacement:"on",
        	minTickInterval:reportJson.minTickInterval,
            categories: reportJson.categories
        },
        yAxis: {
        	allowDecimals:false,
            title: {
                text: '人数'
            },
            labels: {
                formatter: function() {
                    return this.value +'人'
                }
            }
        },
        tooltip: {
            crosshairs: true,
            shared: true
        },
        plotOptions: {
            spline: {
                marker: {
                    radius: 4,
                    lineColor: '#666666',
                    lineWidth: 1
                }
            }
        },
        series: reportJson.series
    });
	}
	  charts=new Highcharts.Chart({
                chart: {
                    renderTo: 'dataCharts',          //放置图表的容器
                    defaultSeriesType: 'column',    //图表类型line, spline, area, areaspline, column, bar, pie , scatter
                    inverted: false                  //左右显示，默认上下正向
                },
                title: {                            
                    text: '粉丝统计',        //图标的标题
                    style:{}                        //标题样式
                },
                subtitle: {                         
                    text: ''              //图标的副标题
                },
                xAxis: {                            
                    categories: ['粉丝总数', '门店用户', '普通用户', '关注用户','曾关注用户'], //X轴的坐标值
                    labels: {
                        rotation: -45,
                        align: 'right',
                        style: {font: 'normal 13px 宋体'}
                    }
                },
                yAxis: {
                    min: 0,
                    title: {text: '数量（人数）'}  //Y轴坐标标题  labels:纵柱标尺
                },
                legend: {                               //【图例】位置样式
                    layout: 'horizontal',               //【图例】显示的样式：水平（horizontal）/垂直（vertical）
                    backgroundColor: '#FFFFFF',
                    borderColor: '#CCC',
                    borderWidth: 1,
                    align: 'center',
                    verticalAlign: 'top',
                    enabled:true,
                    //x: 100,
                    y: 50,
                    //floating: true,
                    shadow: true
                },
                //loading: {  需要配合chart.showLoading();使用
                //    hideDuration: 10000,
                //    showDuration: 10000
                //},
                tooltip: {
                    formatter: function() {                 //当鼠标悬置数据点时的格式化提示
                        return '<b>'+ this.x +'</b><br/>'+ this.series.name + ': '+ Highcharts.numberFormat(this.y, 0);
                    }
                },
                credits: {
                    enabled: false
                },
                plotOptions: {
                    column: {
                        pointPadding: 0.2,  //图表柱形的
                        borderWidth: 0      //图表柱形的粗细 
                        //pointWidth:15    你想显示的宽度(number型）

                    },bar: {
                        dataLabels: {
                            enabled: false
                        }
                    }
                },
                series:[{name: '数量',data: [${bean.totalNum},${bean.mendNum},${bean.feiMendNum},${bean.guanzhuNum},${bean.quxiaoNum}]}] 
            });
});
</script>